The present invention relates in general to integrated circuit operation and more particularly to a method and apparatus for recording program execution in a microprocessor based integrated circuit.
The ultimate test for the design of a microprocessor based integrated circuit is its operation in a system environment. However, the system environment provides little, if any, information about the internal state of the microprocessor to assist in diagnosing any failure that may occur during testing or studying the function of a program being executed by the microprocessor during normal operation. At best, external logic analyzers collect trace data from the system bus and secondary cache interface external to the microprocessor. More often, only the system trace data is captured as the secondary cache interface trace data is difficult mechanically and electrically to capture due to the complex network of short high frequency paths. Even if captured, these external signals provide no ability to determine the internal operation of the microprocessor. One key to solving this problem is to replicate the failure or specific program execution using a diagnostic program short enough to run in a chip tester and a simulator. The difficulty lies in the fact that the diagnostic program must accurately duplicate the processor state associated with a failure or corresponding to a desired execution point. During actual operation of the microprocessor, its dynamic state greatly depends on branch predictions and cache refills. Out of order execution adds another level of complexity to any debugging or program analysis efforts. Without guessing, this information is difficult to reconstruct.
Previous approaches to solving this problem include identifying what instruction was being executed upon the occurrence of a failure, tag an instruction and see how it executes, and counting events over an interval of time. These approaches do not provide information with respect to immediately preceding instructions which set up the desired execution point to be analyzed or are the initiating causes of a failure nor do they illustrate penalties for individual mispredicted branches or cache misses. Therefore, it is desirable to identify the internal state of a processor in order to analyze program execution or identify causes of failure.
From the foregoing, it may be appreciated by those skilled in the art that a need has arisen to record information related to internal operation of a microprocessor in order to analyze and study the operation of a program being executed by the microprocessor. In accordance with the present invention, a method and apparatus for recording program execution in a microprocessor based integrated circuit are provided that substantially eliminate or greatly reduce disadvantages and problems of conventional system program analysis techniques.
According to an embodiment of the present invention, there is provided a method for recording program execution in a microprocessor based integrated circuit that includes identifying an execution point in a program running in a central processing unit of the microprocessor based integrated circuit. Profile information transferred to and from the central processing unit and associated with the execution point is captured for study and analysis. A trace recorder co-located with the central processing unit in the microprocessor based integrated circuit is used to capture the profile information of the desired execution point. The trace recorder is operable to selectively record the profile information in response to various execution points and circuit operations in order to capture operational information that occurs around an execution point or specific circuit operation. In this manner, execution of a program running in the central processing unit can be studied and analyzed.